<template>
  <div class="cc-wrap">
    <van-nav-bar class="cc-van-bar"
                 title="课程评价"
                 right-text="确认"
                 left-arrow
                 @click-left="onClickLeft"
                 @click-right="onClickRight" />
    <van-field class="cc-box"
               v-model="message"
               rows="10"
               autosize
               type="textarea"
               maxlength="150"
               placeholder="输入您对于这一课程的评价~"
               show-word-limit />
  </div>
</template>
<script>
import { Toast } from 'vant'
import { reactive, getCurrentInstance } from 'vue'
export default {
  setup () {
    const { proxy } = getCurrentInstance()
    const data = reactive({

    })
    function onClickLeft () {
      window.history.length > 1 ? proxy.$router.go(-1) : proxy.$router.push('/user/Settings')
    }
    function onClickRight () {
      Toast.success('提交成功')
      proxy.$axios.user.feedback(this.data.message).then(res => {
        if (res.status === 200) {
          Toast.success('提交成功')
          // message = ''
        }
      })
    }
    return {
      data,
      onClickLeft,
      onClickRight
    }
  },
  data () {
    return {
      message: ''
    }
  }
}
</script>
<style lang="scss" scoped>
.cc {
  &-wrap {
    height: 100vh;
  }
  &-box {
    width: 95%;
    margin: 10px auto;
    border-radius: 16px;
  }
}
</style>
